# Why the #@#$ will this not work!
# I have installed the PyGObject Python bindings (needed for GTK+ 3 development
#                                                 in python)
# This works from my command line too... stupid PyDev/Eclipse
#
# Ignore the 'No name 'GIO' in module 'gi.repository' and 'Unresolved import: GIO' PyDev
# warnings; this works just fine with GTK 3 (Gnome3 or Ubuntu Unity desktop), if you have 
# actually installed PyGObject bindings for Python 2.7
#
from gi.repository import Gio # pylint: disable=E0611 
 
class UnityBackgroundChanger():

    SCHEMA = 'org.gnome.desktop.background'
    KEY = 'picture-uri'

    def __init__(self):
        pass
    
    def set_background(self, background):
        gsettings = Gio.Settings.new(self.SCHEMA)
        gsettings.set_string(self.KEY, "file://" + background)